/**
 * @author wItspirit
 * 28-mei-2005
 * ReusableUIFactory.java
 */

package org.scohen.juploadr.ui;

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

/**
 * This factory will store all possible reusable UI elements. These are things
 * like common icons (images), colors, fonts, ...
 * 
 * This factory will make sure that the complete application is capable of
 * accessing these resources. They are also properly managed with regards to
 * disposal.
 * 
 * This interface can be implemented in multiple fashions, depending on the kind
 * or re-use or creation strategy that should be used.
 * 
 * A default implementation is provided. In order to change the default
 * implementation you have to define an implementing class via a system
 * property: juploadr.reusableuifactory.impl
 */
public abstract class ReusableUIFactory {
    private static final String REUSABLE_UI_FACTORY_IMPL_KEY = "juploadr.reusableuifactory.impl";
    private static ReusableUIFactory instance = null;

    public static ReusableUIFactory getInstance() {
        if (instance == null) // Avoids unnecessary locks
        {
            synchronized (REUSABLE_UI_FACTORY_IMPL_KEY) // Required for thread
                                                        // safe instantiation
            {
                if (instance == null) {
                    try {
                        String uiFactoryImplStr = System
                                .getProperty(REUSABLE_UI_FACTORY_IMPL_KEY);
                        instance = (ReusableUIFactory) Class.forName(
                                uiFactoryImplStr).newInstance();
                    } catch (Exception e) {
                        instance = new DefaultReusableUIFactory();
                    }
                }
            }
        }
        return instance;
    }

    /**
     * Returns the Display session used for this application.
     * 
     * @return The current Display session
     */
    public abstract Display getDisplay();

    public abstract Image getLogoImage();

    public abstract Image getTinyLogoImage();

    public abstract Image getUploadingImage();

    public abstract Image getUploadedImage();

    public abstract Image getUnknownImage();

    public abstract Image getRotateRightImage();

    public abstract Image getRotateLeftImage();

    public abstract Image getPhotosetOverlayImage();

    public abstract Color getFriendsColor();

    public abstract Color getFamilyColor();

    public abstract Color getPrivateColor();

    public abstract Color getPublicColor();

    public abstract Color getTagColor();

    public abstract Color getDescriptionColor();

    public abstract Color getTitleColor();

    public abstract Color getThumbnailBorderColor();

    public abstract Color getThumbnailBackgroundColor();

    public abstract Color getThumbnailSelectedBackgroundColor();

    public abstract Color getTagBorderColor();

    public abstract Color getProgressBarColor();
    
    public abstract Color getDisabledTextColor();

    public abstract Color getWhiteColor();

    public abstract Color getBlackColor();

    public abstract Color getAboutDialogFontColor();

    public abstract Font getThumbnailDecorationFont();

    public abstract Font getAuthorizeHeaderFont();

    public abstract Font getAuthorizationFooterFont();

}
